home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / freebusy.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-01-19  |  2.5 KB  |  85 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
  5.     Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.  
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Library General Public License
  18.     along with this library; see the file COPYING.LIB.  If not, write to
  19.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20.     Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef KCAL_FREEBUSY_H
  23. #define KCAL_FREEBUSY_H
  24.  
  25. #include <qdatetime.h>
  26. #include <qvaluelist.h>
  27. #include <qptrlist.h>
  28.  
  29. #include "period.h"
  30. #include "calendar.h"
  31.  
  32. #include "incidencebase.h"
  33.  
  34. namespace KCal {
  35.  
  36.   typedef QValueList<Period> PeriodList;
  37. /**
  38.   This class provides information about free/busy time of a calendar user.
  39. */
  40. class LIBKCAL_EXPORT FreeBusy : public IncidenceBase
  41. {
  42.   public:
  43.     FreeBusy();
  44.     FreeBusy( const QDateTime &start, const QDateTime &end );
  45.     FreeBusy( Calendar *calendar, const QDateTime &start,
  46.               const QDateTime &end );
  47.     FreeBusy( PeriodList busyPeriods );
  48.  
  49.     ~FreeBusy();
  50.     
  51.     QCString type() const { return "FreeBusy"; }
  52.  
  53.     virtual QDateTime dtEnd() const;
  54.     bool setDtEnd( const QDateTime &end );
  55.  
  56.     PeriodList busyPeriods() const;
  57.  
  58.     /** Adds a period to the freebusy list and sorts the list.  */
  59.     void addPeriod( const QDateTime &start, const QDateTime &end );
  60.     void addPeriod( const QDateTime &start, const Duration &dur );
  61.     /** Adds a list of periods to the freebusy object and then sorts
  62.      * that list. Use this if you are adding many items, instead of the
  63.      * addPeriod method, to avoid sorting repeatedly.  */
  64.     void addPeriods( const PeriodList & );
  65.     void sortList();
  66.  
  67.     void merge( FreeBusy *freebusy );
  68.     
  69.   private:
  70.     bool accept( Visitor &v ) { return v.visit( this ); }
  71.     //This is used for creating a freebusy object for the current user
  72.     bool addLocalPeriod( const QDateTime &start, const QDateTime &end );
  73.  
  74.     QDateTime mDtEnd;
  75.     PeriodList mBusyPeriods;
  76.     Calendar *mCalendar;
  77.  
  78.     class Private;
  79.     Private *d;
  80. };
  81.  
  82. }
  83.  
  84. #endif
  85.